﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:eComic">

   <SolidColorBrush x:Key="FilenameForegroundBrush" Color="#FFFFFFFF"/>

    <ControlTemplate x:Key="ScrollViewerControlTemplate1" TargetType="{x:Type ScrollViewer}">
        <Grid x:Name="Grid" Background="{TemplateBinding Background}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Rectangle Fill="{StaticResource GeneralBackgroundBrush}" x:Name="Corner" Grid.Column="1" Grid.Row="1"/>
            <ScrollContentPresenter Margin="{TemplateBinding Padding}" x:Name="PART_ScrollContentPresenter" Grid.Column="0" Grid.Row="0" 
                                    Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" 
                                    CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" 
                                    CanVerticallyScroll="True" MinWidth="50"/>
            <ScrollBar Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Cursor="Arrow" 
                       x:Name="PART_VerticalScrollBar" Grid.Column="1" 
                       Grid.Row="0" ViewportSize="{TemplateBinding ViewportHeight}" Maximum="{TemplateBinding ScrollableHeight}" 
                       Minimum="0" Value="{Binding Path=VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" 
                       AutomationProperties.AutomationId="VerticalScrollBar"/>
            <ScrollBar Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Cursor="Arrow" 
                       x:Name="PART_HorizontalScrollBar" Style="{DynamicResource HorizontalScrollBarStyle}" 
                       Grid.Column="0" Grid.Row="1" Orientation="Horizontal"  
                       ViewportSize="{TemplateBinding ViewportWidth}" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" 
                       Value="{Binding Path=HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" 
                       AutomationProperties.AutomationId="HorizontalScrollBar"/>
        </Grid>
    </ControlTemplate>
    <Style x:Key="ScrollBarButton" TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                      HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" 
                                      VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!-- x:Key="ScrollBarButton"  -->
    <Style x:Key="HorizontalScrollBarPageButton" TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Rectangle Fill="{TemplateBinding Background}" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!--x:Key="HorizontalScrollBarPageButton" -->
    <Style x:Key="HorizontalScrollBarStyle" TargetType="{x:Type ScrollBar}">
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
        <Setter Property="Foreground" Value="{StaticResource GeneralForegroundBrush}"/>
        <Setter Property="Width" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
        <Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollBar}">
                    <Grid>

                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="1*" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <RepeatButton Grid.Row="0"
										  Command="ScrollBar.LineUpCommand"
										  FontFamily="Marlett" Content="t" Style="{DynamicResource SimpleBaseButtonStyle}" />

                        <Track Grid.Row="1" Name="PART_Track">
                            <Track.DecreaseRepeatButton>
                                <RepeatButton Command="ScrollBar.PageUpCommand" />
                            </Track.DecreaseRepeatButton>

                            <Track.IncreaseRepeatButton>
                                <RepeatButton Command="ScrollBar.PageDownCommand" />
                            </Track.IncreaseRepeatButton>

                            <Track.Thumb>
                                <Thumb Style="{DynamicResource ThumbStyle1}" />
                            </Track.Thumb>
                        </Track>

                        <RepeatButton Grid.Row="2"
										  Command="ScrollBar.LineDownCommand"
										  FontFamily="Marlett" Content="u" Style="{DynamicResource SimpleBaseButtonStyle}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Background" Value="{x:Null}"/>
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="Width" Value="Auto"/>
                <Setter Property="MinWidth" Value="0"/>
                <Setter Property="Height" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
                <Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ScrollBar}">
                            <Grid Background="{DynamicResource GeneralBackgroundBrush}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>

                                <RepeatButton Grid.Column="0" Style="{DynamicResource SimpleBaseButtonStyle}"
												  Command="ScrollBar.LineLeftCommand"
												  FontFamily="Marlett" Content="3" />

                                <Track Grid.Column="1" Name="PART_Track">
                                    <Track.DecreaseRepeatButton>
                                        <RepeatButton Command="ScrollBar.PageLeftCommand" Style="{DynamicResource SimpleBaseButtonStyle}" Background="{x:Null}" />
                                    </Track.DecreaseRepeatButton>

                                    <Track.IncreaseRepeatButton>
                                        <RepeatButton Command="ScrollBar.PageRightCommand" Style="{DynamicResource SimpleBaseButtonStyle}" Background="{x:Null}" />
                                    </Track.IncreaseRepeatButton>

                                    <Track.Thumb>
                                        <Thumb Style="{DynamicResource ThumbStyle1}" Background="#FF444444"  />
                                    </Track.Thumb>
                                </Track>

                                <RepeatButton Grid.Column="2" Style="{DynamicResource SimpleBaseButtonStyle}"
												  Command="ScrollBar.LineRightCommand"
												  FontFamily="Marlett" Content="4" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>
    <!-- x:Key="HorizontalScrollBarStyle" -->
    <Style x:Key="SimpleBaseButtonStyle" TargetType="{x:Type RepeatButton}">
        <Setter Property="Background" Value="{StaticResource GeneralBackgroundBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource GeneralForegroundBrush}"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Padding" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border SnapsToDevicePixels="true" x:Name="Chrome" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}">
                        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="#ADADAD"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
 
    
    <Style x:Key="ThumbStyle1" TargetType="{x:Type Thumb}">
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
        <Setter Property="Background" Value="#FF4F4F4F"/>
        <Setter Property="Foreground" Value="{StaticResource GeneralForegroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid>
                            <Border Margin="0,1,0,1" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" 
                                    BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" MinWidth="0"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="BorderBrush" Value="#FFFFFFFF"/>
    </Style>
</ResourceDictionary>
